Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warnings to BidsDataset properties slated for change #251

Merged
merged 5 commits into from
Feb 21, 2023

Conversation

pvandyken
Copy link
Contributor

Resolves #237.

This PR does not yet include any changes to the docs, as the rewrite will be a bit complicated, and I may want to incorporate the pretty printing #197 into it to ease the explanations.

I'm using the deprecation library, or rather, a custom fork of it. I wanted the deprecations to be displayed prominently in the docs, and the default sphinx directive just displays it as vanilla text without any box or anything. So I modified deprecation to allow me to nest the deprecation message in a warning box. I've raised an issue there about incorporating this into the main repository.

One other note: by default, Python actually doesn't display DeprecationWarnings. This is to prevent end-users of an app from seeing warnings that don't pertain to them. For example, if Hippunfold upgrades snakebids to this PR but doesn't make the syntax changes in their workflow, there's no reason for their users to see all the resulting warning messages.

In order to the warnings they have to be enabled. Test suites do this by default. You can also call your script as python -Wdefault.

The problem is I don't know that snakemake users are typically using test suites on their workflows, and would probably never think to use the -W flag. So probably no one will ever see the warnings.

So we can just rely on the docs and changelogs to get people to migrate. There's also a separate FutureWarning that is always displayed, but then end users of the app will also see it.

Any ideas or thoughts on this are appreciated.

Currently using a custom fork of the library to get allow custom
deprecation admonitions in the docs
Copy link
Contributor

@tkkuehn tkkuehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@pvandyken
Copy link
Contributor Author

pvandyken commented Feb 21, 2023

@tkkuehn, great, so no concern about users devs not seeing the warnings?

@tkkuehn
Copy link
Contributor

tkkuehn commented Feb 21, 2023

Yeah, my sense is that it's more important for end users not to get drowned in a bunch of error messages they can't address than for maintainers to see these warnings. I think updating the docs should be sufficient for anyone who's likely to eventually make the switch to Snakebids 1.0.0 (and we'll point them to the changes increasingly more clearly as we approach release of 1.0.0).

@pvandyken
Copy link
Contributor Author

Great, just a few text changes I noticed that I'd like to fix before merging

Deprecate the Component getter properties (that currently allow
dataset->attr->component) to allow for future modification of those
properties
The entire docstring can still be copied using the
copy_extended_docstring property
Remove existing references to the deprecated BidsDataset properties.
Some functions, including the tests of these properties, call them by
necessity, so DeprecationWarnings are ignored at these points
The test was checking if dataset.input_lists was equal to itself, rather
than to dataset.entities
@pvandyken pvandyken force-pushed the deprecate-bidsdataset-features branch from c47586f to 402d3a4 Compare February 21, 2023 16:12
@pvandyken pvandyken merged commit 40d7044 into khanlab:main Feb 21, 2023
@pvandyken pvandyken deleted the deprecate-bidsdataset-features branch February 21, 2023 16:24
@pvandyken pvandyken added the enhancement New feature or request label Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate BidsDataset attributes slated for breaking changes
3 participants